home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / gs3.53 / make.doc < prev    next >
Text File  |  1996-01-10  |  42KB  |  947 lines

  1.    Copyright (C) 1989, 1995 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17.  
  18. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  19.  
  20. This file, make.doc, describes how to install Ghostscript, and how to
  21. build Ghostscript executables from source.
  22.  
  23. For an overview of Ghostscript and a list of the documentation files, see
  24. README.
  25.  
  26. ********
  27. ******** Installing Ghostscript
  28. ********
  29.  
  30. To install the interpreter, you need:
  31.     - The interpreter executable:
  32.         - On MS-DOS systems:
  33.             - With 80286 CPUs, gs.exe.
  34.             - With 32-bit CPUs and using the Watcom compiler,
  35.               gs386.exe and the DOS extender dos4gw.exe.
  36.             - With 32-bit CPUs and using the DJGPP compiler,
  37.               gs.exe and the DOS extender go32.exe.
  38.         - On MS Windows:
  39.             - Ordinarily, gswin.exe.
  40.             - With Win32s, gswin32.exe.
  41.         - On MS Windows NT, gswin32.exe.
  42.         - On OS/2, gsos2.exe and gspmdrv.exe.
  43.         - On VMS systems, gs.exe.
  44.         - On Unix systems, gs.
  45.     - The interpreter initialization files:    gs_*.ps.
  46.     - The font map: Fontmap.
  47.  
  48. See use.doc for a description of the search algorithm used to find these
  49. files.
  50.  
  51. You do not need any of these files when using the library; however, the
  52. library currently provides no way to install fonts.  This is obviously
  53. ridiculous and will be fixed sometime in the future.
  54.  
  55. ********
  56. ******** Building Ghostscript from source
  57. ********
  58.  
  59. Ghostscript is generally distributed in the form of a compressed tar file
  60. (.tar.gz).  When unpacked, this file puts all the Ghostscript files in a
  61. directory called gsA.BC, where A.BC is the version number.  Ghostscript is
  62. also available in the form of PC-compatible .zip files.
  63.  
  64. Ghostscript uses a library provided by the Independent JPEG Group.  This
  65. library is included in the Ghostscript distribution in a separate file.  If
  66. you already have a copy of a version of this library that is compatible
  67. with Ghostscript, you won't have to FTP or unpack it again.  Please see the
  68. file jpeg.mak for information about which version(s) of the IJG code are
  69. compatible with Ghostscript.  This library does not include the gsA.BC
  70. prefix; you should make the gsA.BC directory current before you unpack the
  71. JPEG archive.
  72.  
  73. Ghostscript also uses the freely available PNG and ZLIB libraries.  These
  74. libraries are also included in the distribution in separate files.  Please
  75. see png.mak for more information.
  76.  
  77. Ghostscript is described by a collection of several makefiles:
  78.  
  79.     gs.mak, jpeg.mak, png.mak - generic makefiles used on all platforms
  80.       (except VMS).
  81.     devs.mak - a makefile listing all the device drivers.
  82.     *.mak - the makefiles for specific platforms.
  83.  
  84. You may need to edit the platform-specific makefile if you wish to change
  85. any of the following:
  86.  
  87.     - The name of the makefile itself (MAKEFILE macro);
  88.  
  89.     - The default search path(s) for the initialization and font files
  90.       (GS LIB_DEFAULT_macro);
  91.  
  92.     - The debugging options (DEBUG and TDEBUG macros);
  93.  
  94.     - The set of device drivers to be included (DEVICE_DEVS
  95.       and DEVICE_DEVS1..15 macros);
  96.  
  97.     - The set of optional features to be included (FEATURE_DEVS)
  98.  
  99. The platform-specific makefile will include comments describing all of
  100. these items except the DEVICE_DEVS options; the available DEVICE_DEVS
  101. options (device drivers) are described in devs.mak, even though the file
  102. that must be edited is the platform-specific makefile.  (These comments do
  103. not apply to the VMS platform; it has its own procedures, which are
  104. described near the end of this document.)
  105.  
  106. The makefiles distributed with Ghostscript define these options as
  107. follows:
  108.  
  109.     - MAKEFILE: the xxx.mak name of the makefile as distributed
  110.       (platform-specific).
  111.  
  112.     - GS_LIB_DEFAULT: on Unix systems, /usr/local/lib/ghostscript/N.NN
  113.     and /usr/local/lib/ghostscript/fonts/N.NN, where N.NN is the
  114.     Ghostscript release number (e.g., 3.33); on MS-DOS systems, . and
  115.     C:\GS.  Note that on Unix systems, GS_LIB_DEFAULT does not include
  116.     . (the current directory).
  117.  
  118.     - DEBUG, TDEBUG: no debugging code included in the build.
  119.  
  120.     - DEVICE_DEVS*: platform-specific, see below.
  121.  
  122.     - FEATURE*: platform-specific.
  123.  
  124. There are also platform-specific options described below under the
  125. individual platforms.  See the "Options" section near the beginning of the
  126. relevant makefile for more information.
  127.  
  128. If you are including a dot-matrix printer driver, you may wish to
  129. customize the default resolution parameters in devs.mak.
  130.  
  131. To build the interpreter, you need all the .h and .c files (and .asm files
  132. for MS-DOS, and .def files for MS Windows) included in the distribution, as
  133. well as the makefiles.
  134.  
  135. The command
  136.     make clean
  137. removes all the files created by the build process (relocatables,
  138. executables, and miscellaneous scratch files).  If you want to save the
  139. executable, you should move it to another directory first.
  140.  
  141. Features and devices
  142. --------------------
  143.  
  144. When compiling Ghostscript, you may configure it with any of a variety of
  145. features, and with any subset of the available device drivers.  You will
  146. find the complete list of features in a comment at the beginning of the file
  147. gs.mak, and the complete list of drivers in a comment at the beginning of
  148. devs.mak.
  149.  
  150. To find out what devices a particular makefile selects for inclusion in
  151. the executable, find the line in the makefile of the form
  152.     FEATURE_DEVS=<list of features>
  153. and
  154.     DEVICE_DEVS=<list of devices>
  155.     (similarly DEVICE_DEVS1... up to DEVICE_DEVS15)
  156. For example, the makefile for Unix platforms defines
  157.     FEATURE_DEVS=level2.dev
  158. indicating that the PostScript Level 2 facilities should be included.  You
  159. may wish to add
  160.     FEATURE_DEVS=level2.dev pdf.dev
  161. to add the ability to interpret PDF files.  The Unix makefile also defines
  162.     DEVICE_DEVS=x11.dev
  163.     DEVICE_DEVS9=pbm.dev pbmraw.dev pgm.dev pgmraw.dev ppm.dev ppmraw.dev
  164. indicating that the X11 driver and all of the Portable Bit/Gray/PixMap
  165. file drivers should be included.
  166.  
  167. You may edit the FEATURE* lines to select any desired set of features (as
  168. listed near the beginning of gs.mak), and the DEVICE_DEVS* line(s) to select
  169. any desired set of device drivers (as listed near the beginning of
  170. devs.mak).  The first device listed in the definition of DEVICE_DEVS will be
  171. used as the default device (unless overridden from the command line with
  172. -sDEVICE=xxx, of course.)  If you can't fit all the devices on a single
  173. line, you may add lines defining
  174.     DEVICE_DEVS2=<dev21>.dev ... <dev2n>.dev
  175.     DEVICE_DEVS3=<dev31>.dev ... <dev3n>.dev
  176. etc. up to DEVICE_DEVS15.  Don't use continuation lines -- this doesn't
  177. work on some platforms.
  178.  
  179. Cross-compiling
  180. ---------------
  181.  
  182. If you are compiling Ghostscript on machine X with a cross-compiler that
  183. generates code for machine Y, you need to do one extra step.  Rather than
  184. simply giving the command
  185.     make
  186. you must proceed in three steps.  First,
  187.     make arch.h
  188. Then edit arch.h to reflect the architecture of machine Y.  Then,
  189.     make
  190.  
  191. ********
  192. ******** How to build Ghostscript from source (PC version) ********
  193. ********
  194.  
  195. The relevant makefiles are:
  196.     Turbo C: tc.mak
  197.     Turbo C++/Borland C++, MS-DOS: bc.mak
  198.     Borland C++, MS Windows: bcwin.mak
  199.     Borland C++ 4.0, MS Windows with Win32s or MS Windows NT: bcwin32.mak
  200.     Microsoft C/C++ 7.0, MS-DOS: msc.mak
  201.     Watcom C/386 or C++, MS-DOS: watc.mak
  202.     Watcom C/386 or C++, MS Windows (NOT DEBUGGED YET): watcwin.mak
  203.     DJGPP, DESQview/X: dvx-gcc.mak
  204. The options were chosen to strike a balance between RAM consumption and
  205. likely usefulness.  (Turbo C is limited to 640K and does not support code
  206. overlaying; Borland C++ is limited to 640K, but supports code overlaying
  207. under MS-DOS; the Watcom and DJGPP compilers are not limited to 640K.)
  208.  
  209. To build Ghostscript, you need MS-DOS version 3.3 or later, and a (Borland)
  210. Turbo C/C++, Borland C/C++, Microsoft C/C++ (version 7), Watcom C/386
  211. (version 8.5 or later) or C++ (any version), or the free djgpp + go32
  212. development system.  Details are given below.
  213.  
  214. As noted above, the default configuration generates an executable that
  215. assumes the directory where 'make' was run should be the final default
  216. directory for looking up the Ghostscript initialization and font files.
  217.  
  218. To build the Ghostscript executable, all you need to do is give the
  219. command
  220.     make
  221. You must have COMMAND.COM in your path to build Ghostscript.
  222.  
  223. There is a special 'make' target that simply attempts to compile all the
  224. .c files in the current directory.  Some of these compilations will fail,
  225. but the ones that succeed will go considerably faster, because they don't
  226. individually pay the overhead of loading the compiler into memory.  So a
  227. good strategy for building the executable for the first time, or after a
  228. change to a very widely used .h file, is:
  229.     make begin
  230. and then
  231.     make
  232. to do the compilations that failed the first time.
  233.  
  234. Note: if you get the Ghostscript sources from a Unix 'tar' file and unpack
  235. the file on a MS-DOS machine, the files will all have linefeed instead of
  236. carriage return + linefeed as the line terminator, which may make the C
  237. compiler unhappy.  I don't know the simplest way to fix this: just reading
  238. each file into an editor and writing it back out again may be sufficient.
  239. You will probably have to do this to the .c, .h, and .bat files.
  240.  
  241. Borland environment
  242. -------------------
  243.  
  244. To compile Ghostscript with the Borland environment, you need either Turbo
  245. C (version 2.0 or later) or Turbo C++ or Borland C++ (version 1.0 or
  246. later); specifically, the compiler, 'make' utility, and linker.  You also
  247. need either the Borland assembler (version 1.0 or later) or the Microsoft
  248. assembler (version 4.0 or later).  Before compiling or linking, you should
  249. execute
  250.     echo !include "tc.mak" >makefile
  251. (for Turbo C and MS-DOS), or
  252.     echo !include "bc.mak" >makefile
  253. (for Turbo C++ or Borland C++ and MS-DOS), or
  254.     echo !include "bcwin.mak" >makefile
  255. (for Turbo C++ or Borland C++ and Microsoft Windows), or
  256.     echo !include "bcwin32.mak" >makefile
  257. (for Borland C++ and Microsoft Windows with Win32s or Microsoft Windows NT)
  258.  
  259. Besides the source files and the makefiles, you need:
  260.     turboc.cfg (the flags and switches for Turbo C)
  261.     gs.tr (the linker commands for the interpreter)
  262.     *.bat (a variety of batch files used in the build process)
  263.  
  264. There are extensive comments in the aforementioned .mak files
  265. regarding various configuration parameters.  If your configuration is
  266. different from the following, you should definitely read those
  267. comments and see if you want or need to change any of the parameters:
  268.     - The compiler files are in c:\tc (for Turbo C) or c:\bc (for
  269. Turbo C++ or Borland C++) and its subdirectories.
  270.     - You are using the Borland assembler (tasm).
  271.     - You want an executable that will run on any PC-compatible,
  272. regardless of processor type (8088, 8086, V20, 80186, 80286, V30, 80386,
  273. 80486) and regardless of whether a math coprocessor (80x87) is present.
  274.  
  275. NOTE: Borland C++ 3.0 has two problems that affect Ghostscript (these
  276. problems are fixed in Borland C++ 3.1):
  277.  
  278.     - The assembler, tasm, often crashes when attempting to
  279. assemble gdevegaa.asm.  If this happens, try again, or use another
  280. assembler (e.g., an older version of tasm) if you have one, or set
  281. USE_ASM=0 in the makefile.
  282.  
  283.     - The math library for Microsoft Windows, mathwl.lib, has a
  284. bug that causes floating point numbers to print incorrectly.  Contact
  285. Borland for a corrected version.
  286.  
  287. If you are compiling Ghostscript with Turbo C++ 1.0, remove the
  288. `.swap' directive from bc.mak, and use the -s switch on the `make'
  289. command line.  (All later versions of the Borland environment
  290. recognize this directive.)
  291.  
  292. Note that although the Microsoft Windows version of Ghostscript will
  293. run under Windows 3.0, it uses routines from the Windows 3.1 SDK, so
  294. you need the Windows 3.1 SDK and header files to compile it.  In
  295. practice, this means that you need Borland C++ 3.1; Borland C++ 3.0
  296. doesn't include the necessary headers.
  297.  
  298. If building for the MS Windows Win32s environment, you need bcc32.cfg
  299. instead of turboc.cfg.  The make process will stop after it has created
  300. genarch.exe.  You should then run 'win genarch arch.h', wait until genarch
  301. has finished and then exit MS Windows.  Then type 'make' again to restart
  302. the make process.
  303.  
  304. If building for MS Windows NT, you also need bcc32.cfg instead of
  305. turboc.cfg, but the make process will run to completion automatically.
  306.  
  307. Microsoft environment
  308. ---------------------
  309.  
  310. To compile Ghostscript with the Microsoft environment, you need Microsoft
  311. Visual C++ 1.0 or later with its associated `nmake' utility and linker.
  312. Before compiling or linking, you should execute
  313.     echo !include msc.mak >makefile
  314.  
  315. Besides the source files and the makefiles, you need:
  316.     gs.tr (the linker commands for the interpreter)
  317.     *.bat (a variety of batch files used in the build process)
  318.  
  319. All previous versions of Microsoft C/C++ are of such poor quality that we
  320. strongly advise you not to attempt to compile Ghostscript with them.  In
  321. particular, C/C++ 7.0 is the first version that is even close to being
  322. ANSI-compliant, and its 'nmake' program is very unreliable (it crashes
  323. partway through the build process with a variety of error messages, or no
  324. error message) and cannot write its error messages to a file.
  325.  
  326. Aladdin Enterprises does not currently have a copy of the Microsoft
  327. compiler.  If you encounter problems with it, we will not be able to help
  328. you; please post them to the Usenet gnu.ghostscript.bug newsgroup.
  329.  
  330. Watcom environment
  331. ------------------
  332.  
  333. Before compiling, change the definition of the WCVERSION macro in the
  334. makefile (watc.mak or watcwin.mak) to the version of the Watcom compiler you
  335. are using.  This is necessary to handle some minor incompatibilities between
  336. versions.
  337.  
  338. To avoid annoying messages from the DOS extender, add the line
  339.     set DOS4G=quiet
  340. to your autoexec.bat file. 
  341.  
  342. To compile Ghostscript with the Watcom compiler, create a makefile by
  343. executing
  344.  
  345.     echo !include watc.mak >makefile
  346.  
  347. To build Ghostscript, execute
  348.  
  349.     wmakel -u
  350.  
  351. Note that Watcom C/386 version 8.5 does not include wmakel (the 32-bit
  352. version of wmake).  If this is the version that you have, try using wmake
  353. instead, i.e.,
  354.  
  355.     wmake -u
  356.  
  357. If you get an "Error(F01): Out of memory" with Watcom 8.5, you may wish to
  358. try reducing the total size of the makefiles by editing devs.mak to remove
  359. drivers that you don't ever intend to use.  If you still get this error,
  360. contact Watcom technical support; they will be able to send you the wmakel
  361. program, probably at no charge.
  362.  
  363. The Watcom 10.0 linker can also run out of memory, apparently because it
  364. tries to read the entire contents of the current directory into the bottom
  365. 640K.  If you get an out-of-memory error, first try copying all of the
  366. source files (*.c, *.h) and build files (*.bat, *.mak, makefile) to an empty
  367. directory and starting over.  If you still get an out-of-memory error on the
  368. final link step, execute the following manually:
  369.  
  370.    \watc\bin\wlink DEBUG ALL NAME gs386 OPTION MAP=gs386 FILE gs @objw.tr @objwl.tr
  371.  
  372. DesqView/X and djgcc/djgpp environment
  373. --------------------------------------
  374.  
  375. The name of the makefile for this environment is dvx-gcc.mak.
  376.  
  377. The DesqView/X port of Ghostscript was contributed by Tom Brosnan
  378. (tjb@chalone.stanford.edu), with further contributions by Stephen Turnbull
  379. (turnbull@shako.sk.tsukuba.ac.jp).  It uses djgcc (DJ Delorie's MSDOS port
  380. of gcc) for compiling.  djgcc assumes that go32.exe is in your search path.
  381. You need to set an environment variable to tell go32 where to put any
  382. paging files, e.g.
  383.  
  384.     set GO32TMP=e:/tmp
  385.  
  386. If you don't have go32.exe, you can get it from Internet host
  387. oak.oakland.edu.  The extender and minimum run-time environment are in the
  388. file djeoeXXX.zip, where XXX is the version number (currently 112).
  389. Patched versions of the extender (as well as other components) are found in
  390. the files djXXXmY.zip, XXX is again the compiler version, Y is the
  391. patchlevel.  Y is currently 2.  People who are just running the executable
  392. need only get the file with the highest level of Y that contains GO32.EXE
  393. and do "unzip -j djXXXmY go32.exe" (InfoZIP) or "pkunzip djXXXmY go32.exe"
  394. (PKWare), then move the extender to their PATH.  If you do not have a
  395. hardware FPU, you will also need the floating point emulator EMU387 found
  396. in djeoeXXX.zip (and possibly in the patch releases as well).  You MUST use
  397. an emulator designed to work with GO32; the emulators often found as TSRs
  398. will not work.  See the file README found in djeoeXXX.zip, or the file
  399. README.1ST in pub/msdos/djgpp on Simtel for further information.
  400.  
  401. The DJGPP v1.12 compiler suite is known to have problems with linking
  402. large file sets.  If you run into this problem, you can work around it
  403. by using the v1.11 GO32 as follows:
  404. (1) get dj111m5.zip from turnbull.sk.tsukuba.ac.jp:/pub/djgpp/1.11
  405. (2) unzip GO32.EXE.  Be careful not to overwrite other versions!
  406. (3) rename it, eg, to GO111M5.EXE
  407. (4) move the renamed GO32.EXE to your path
  408. (5) stubedit ld.exe:  (the stubedit utility is part of djeoe112.zip)
  409.     (a) change the extender name to the one you chose in (3).  The
  410.         .EXE extension may be omitted
  411.     (b) change the version required to 1.11
  412.     (c) accept the defaults for the remaining options.
  413.  
  414. Stephen Turnbull observed the following two problems with DJGPP v2.0-beta2.
  415.  
  416. (1) The v1.12 stdio.h defined a number of flags for manipulating the
  417.     various characteristics of the streams being processed, such as
  418.     _IORD, _IOWRT, etc.  These are missing from v2.0-beta2.  I don't
  419.     know enough about the new libc.a to guess whether this is an
  420.     oversight or these functions have a new (Posix?) interface.
  421.     [Caveat: In Ghostscript the compiler error can be silenced by
  422.     adding "#define _IOWRT 00002" to the file gp_dvx.c.  I don't know
  423.     that this is correct in the new libraries.  I suspect there is no
  424.     real loss in Ghostscript to removing the offending flag
  425.     manipulation from gp_open_printer() in gp_dvx.c, as it is a
  426.     performance optimization.]
  427.  
  428. (2) The big problem is linking with third-party libraries not compiled
  429.     with v2.0.  In particular, QuarterDeck's contributed Xlib
  430.     (compiled with DJGPP v1.12 (original release).  Unfortunately,
  431.     v1.12 uses the usual macros for character classification and
  432.     implementation of the stdio streams.  This leads to long lists of
  433.     complaints from the linker about undefined references to '_ctype_'
  434.     (the table of character type flags) and '_iob' (the table indexed
  435.     by file descriptors) when processing Xlib functions.
  436.  
  437. ********
  438. ******** How to build Ghostscript from source (Mac version) ********
  439. ********
  440.  
  441. There are additional Mac-specific source files in a separate distribution
  442. from the rest of Ghostscript.  In addition to the standard Ghostscript
  443. sources, you will need the following files:
  444.  
  445.     macgs-v1.0-src.sit    - the source files, StuffIt archive.
  446.     manual.txt            - the manual as unformatted text
  447.     readme.txt            - this file
  448.  
  449. These should be in the mac directory located in the same place you retrieved
  450. the rest of the Ghostscript distribution.
  451.  
  452. The first file is a StuffIt archive.  If you do not have a program to expand
  453. it, you should get the free StuffIt Expander program from your favorite
  454. Macintosh archive.
  455.  
  456. In the standard method of building Ghostscript, all of these files (except
  457. the jpeg) get unpacked into one big directory.  The jpeg stuff gets unpacked
  458. into a directory called jpeg-6 in the main directory.  The Macintosh stuff
  459. also gets unpacked into its own directory, called 'Mac Specific'.  However,
  460. if you like (and I do) you can divide up all these files into the following
  461. hierarchy:
  462.  
  463.     Ghost Dev
  464.         files -- all *.ps, *.doc, and other non-build files
  465.         fonts -- all the fonts
  466.         src -- *.c, *.h, *.mak
  467.         jpeg-6 -- the jpeg files
  468.         Mac Specific -- the mac files
  469.         MPW Build -- empty directory used for building under MPW
  470.  
  471. Once you get everything laid out, take a look at the file Worksheet in the
  472. mac specific folder for complete steps to build the system with either MPW
  473. or CodeWarrior.
  474.  
  475. ********
  476. ******** How to build Ghostscript from source (OS/2 version) ********
  477. ********
  478.  
  479. The relevant makefile is:
  480.     os2.mak
  481. The EMX/GCC 0.8h compiler and the IBM NMAKE.EXE are required.
  482.  
  483. Before compiling or linking, you should execute
  484.     copy os2.mak makefile
  485. Then to start the make process type
  486.     nmake
  487. Two EXE's will be produced: gsos2.exe (Ghostscript) and gspmdrv.exe (the
  488. Presentation Manager display driver).  gsos2.exe will also run under MS-DOS
  489. if a device other than os2pm is selected.
  490.  
  491. ********
  492. ******** How to build Ghostscript from source (Unix version) ********
  493. ********
  494.  
  495. The makefile distributed with Ghostscript selects the following devices
  496. for inclusion in the build:
  497.     Display: X Windows driver.
  498.     File output: pbm, pbmraw, pgm, pgmraw, ppm, and ppmraw drivers.
  499.  
  500. Before compiling or linking, you should execute
  501.  
  502.     ln -s unix-cc.mak makefile
  503. or    ln -s unix-gcc.mak makefile
  504. or    ln -s unixansi.mak makefile
  505.  
  506. (if your Unix system doesn't support symbolic links, omit the -s switch)
  507. depending on whether your C compiler is a traditional Kernighan & Ritchie C
  508. compiler, gcc, or an ANSI C compiler other than gcc respectively.  (If you
  509. want to use gcc in traditional mode, use unix-cc.mak and define the CC macro
  510. to refer to gcc.)
  511.  
  512. The unix-*.mak files are actually generated mechanically from *head.mak,
  513. *tail.mak, unix-end.mak, gs.mak, jpeg.mak, png.mak, and devs.mak by a script
  514. called tar_cat.  If for some reason your copy of Ghostscript doesn't include
  515. the unix-*.mak files, run tar_cat to construct them.  If you wish to edit
  516. any part of the makefile,
  517.  
  518.     DO NOT EDIT THE FILE NAMED makefile OR unix{ansi,cc,gcc}.mak.
  519.     EDIT THE ORIGINAL COMPONENT MAKEFILE (*head.mak, *tail.mak,
  520.     unix-end.mak, gs.mak, jpeg.mak, png.mak, OR devs.mak) AND RUN
  521.     tar_cat AGAIN.
  522.  
  523. Consult tar_cat to find the names of the component files.
  524.  
  525. If the X11 client header files are located in some directory which your
  526. compiler does not automatically search, you must change the XINCLUDE macro
  527. the makefile to include a specific -I switch.  See the comment preceding
  528. XINCLUDE in the makefile.
  529.  
  530. Currently Ghostscript is set up to compile and link in a generic Unix
  531. environment.  Some Unix environments may require changing the LDFLAGS
  532. macro in the makefile.
  533.  
  534. All you need to do to make an executable is invoke the shell command
  535.     make
  536.  
  537. Ghostscript uses ANSI syntax for function definitions. Because of this,
  538. when compiling with cc, it must preprocess each .c file to convert it to
  539. the older syntax defined in Kernighan and Ritchie, which is what most
  540. current Unix compilers (other than gcc) support.  This step is
  541. automatically performed by a utility called ansi2knr, which is included in
  542. the Ghostscript distribution.  The makefile automatically builds ansi2knr.
  543.  
  544. The ansi2knr preprocessing step is included in the makefile rule for
  545. compiling .c files.  ansi2knr creates a file called _temp_.c to hold the
  546. converted code.  If you want to change this name for some reason, it is
  547. defined in unix-cc.mak.
  548.  
  549. Platform-specific notes
  550. -----------------------
  551.  
  552. 386 Unix:
  553.     gcc versions older than 1.38 on Intel 80386 systems do not
  554. compile Ghostscript correctly using the -O option.  Do not use -O in
  555. these environments.
  556.     gcc 1.39 under 386BSD has a bug that causes float-to-integer
  557. conversions to compile incorrectly.  Do not use this version of gcc.
  558.     X11R5 may need #include <stddef.h> in x_.h.
  559.     Also see below regarding System V platforms.
  560.  
  561. Alpha (AXP) with OSF/1.2:
  562.     The optimizer in cc is broken.  If you are compiling with cc, use
  563. the unixansi.mak makefile, and the command line
  564.         make CC=cc CFLAGS= EXTRALIBS=-lXmu
  565.     If you are compiling with gcc, use version 2.5.0 or later, with
  566. the unix-gcc.mak makefile, and the command line
  567.         make CFLAGS=-O2 EXTRALIBS=-lXmu
  568. (libXmu is needed to resolve reference _XEditResCheck from libXt, which is
  569. peculiar to OSF/1.)
  570.     You will probably need to change the definition of INSTALL in the
  571. makefile from install to installbsd.
  572.  
  573. Alpha (AXP) with OSF/1.3:
  574.     The optimizer is OK, but needs to be told to allocate extra table
  575. space to be able to handle some of the larger files:
  576.         make CC=cc CFLAGS="-Olimit 1000"
  577.     The linker in the c89 compiler is broken, so even if you compile
  578. with c89, you must link with cc.  You do not need to set EXTRALIBS=-lXmu.
  579.     You will probably need to change the definition of INSTALL in the
  580. makefile from install to installbsd.
  581.  
  582. Alpha (AXP) with OpenVMS:
  583.     DEC C V4.0 or later is required.  The DEC C V1.3 run-time library
  584. has bugs that prevent Ghostscript from working.
  585.  
  586. Apollo:
  587.     You must run the compiler in ANSI-compatible mode (i.e., set AK=
  588. <null string> in the makefile); otherwise, it gives incorrect error
  589. messages for any function declared as returning a float value.
  590.     The Apollo compiler may not compile Ghostscript correctly.  If you
  591. get unexpected crashes at run time, use gcc.
  592.  
  593. AT&T 7040 R3:
  594.     If Ghostscript crashes on startup, recompile with -O0 in order to
  595. avoid triggering compiler bugs.
  596.  
  597. Convex:
  598.     Use unixansi.mak.  Do not invoke optimization (-O1): there
  599. are compiler bugs that lead to incorrect code.  Set CFLAGS to
  600.     -no -fn -tm c1
  601.  
  602. DEC:
  603.     See Alpha (above) or VAX (below).  Also, you may get the following
  604. message (or a similar one) when compiling on a DECstation, due to a
  605. compiler bug:
  606.     cfe: Fatal: _temp_19086.c: Segmentation violation
  607. If this happens, try compiling with the -oldc switch.
  608.  
  609. DECStations with Ultrix:
  610.     You may wish to set
  611.   GS_LIB_DEFAULT=$(gsdatadir):/usr/lib/DPS/outline/decwin:$(gsdatadir)/fonts
  612. in the makefile to add the Display PostScript font directory to the font
  613. search path.
  614.     You may need to use
  615.         make CFLAGS="-Olimit 1000"
  616. to tell the optimizer to allocate extra table space.
  617.     The Ultrix 4.4 C compiler has a bug that makes it compile gdevm1.c
  618. incorrectly.  Insert the following line in the makefile rule for
  619. gdevm1.$(OBJ) (the body of the rule is empty in the standard distribution):
  620.     $(CCC) -oldc gdevm1.c
  621.  
  622. GNU make (any platform):
  623.     Current versions of GNU `make' have no problems, but GNU make 3.59
  624. can't handle the final linking step in some cases; use the platform's
  625. standard make (e.g., /bin/make) if this happens.
  626.     
  627. H-P RISC workstations:
  628.     If you are using H-P's compiler, use the compiler flags -Ae +O3
  629. (*not* -O) -DNOSYSTIME.  You may also need -D_POSIX_SOURCE.  In addition,
  630. if you get the error message
  631.     Initializing... Unrecoverable error: typecheck in .registerencoding
  632.     Operand stack:
  633.         .notdef  0
  634. when you start Ghostscript, you need to install the following patches to
  635. fix bugs in H-P's C compiler: PHSS_5734, PHSS_5723.
  636.     If you are using gcc 2.5.8, use -O, not -O2; the latter generates
  637. incorrect code for at least one module (gsimage.c).
  638.  
  639. Intergraph Clipper:
  640.     Recommended settings are:
  641.         XCFLAGS=-w -Q -DSYSV -D__SVR3
  642.         EXTRALIBS=-lbsd -lc_s
  643.         CC=acc -knr
  644.         PLATFORM=sysv_
  645. Also, you will probably need to change the X11 driver specification from
  646.     $(SHP)gsaddmod x11 -lib Xt X11 Xext
  647. to
  648.     $(SHP)gsaddmod x11 -lib Xt_s X11_s Xext
  649.  
  650. ISC Unix:
  651.     For ISC Unix with gcc, an appropriate make invocation is:
  652.     make XCFLAGS="-D__SVR3 -posix" LDFLAGS="-shlib -posix" \
  653.          EXTRALIBS="-linet -lnsl_s"
  654. If this doesn't work for you, try removing the -shlib.  ISC Unix may
  655. also need one or more of the following in EXTRALIBS: -lpt, -lc_s.
  656. See also under "386 Unix" above.
  657.  
  658. MIPS:
  659.     There is apparently a bug in the MIPS C compiler which causes
  660. gxdither.c to compile incorrectly if optimization is enabled (-O).  Until
  661. a work-around is found, do not use -O with the MIPS C compiler.
  662.  
  663. NCR 3550:
  664.     If you are using the NCR C Development Toolkit, you must use -O0 to
  665. avoid triggering compiler bugs.
  666.  
  667. NeXTSTEP:
  668.     Use unix-gcc.mak -- i.e., execute
  669.         ln -s unix-gcc.mak Makefile
  670.  
  671. For NeXTSTEP versions before 3.2:
  672.     edit gcc-head.mak ->
  673.         change CC=gcc to CC=cc
  674.         add -D_NEXT_SOURCE to CFLAGS
  675.     change the two occurrences of sys/time.h to ansi/time.h, and
  676.     change <dirent.h> in gp_unifs.c to <sys/dirent.h>
  677.  
  678. For NeXTSTEP 3.2:
  679.     edit gcc-head.mak ->
  680.         change CC=gcc to CC=cc
  681.         add -D_POSIX_SOURCE tand remove -g in CFLAGS
  682.         remove -Wstrict-prototypes in GCFLAGS
  683.  
  684. Add the following line to the end of Fontmap
  685.         /Ohlfs    /Courier    ;
  686.  
  687. If you are running the Pencom co-Xist X server (Development version), the X
  688. headers and libraries are in the default places, so you should change the
  689. definitions of XINCLUDE and XLIBDIRS in the makefile to empty strings.
  690.  
  691. Pyramid MIServer-S:
  692.     See AT&T 7040 R3.
  693.  
  694. RS/6000:
  695.     Many versions of the AIX C compiler have bugs that have prevented
  696. Ghostscript from compiling and linking properly.  We believe that the
  697. current Ghostscript release works around these bugs, and that using the
  698. unix-cc.mak makefile with
  699.     CC=cc
  700. should work.  You must also edit the makefile (unixansi.mak or
  701. unix-cc.mak) to change INSTALL to /usr/ucb/install.  (If -DSYSV produces a
  702. complaint about the functions index and rindex not being defined, try
  703. removing it.)  If the xlc 1.2.1 optimizer runs out of memory, you may need
  704. to add -qmaxmem=4000 to CFLAGS.
  705.     A user has reported that the AIX C compiler shipped with AIX 3.2.5
  706. only compiles Ghostscript if invoked with c89 -D_POSIX_SOURCE and *without*
  707. -O.  On the other hand, another user reported successful compilation using
  708. the unix-ansi.mak makefile and the following command line:
  709.     make CC=c89 XCFLAGS="-DOSY_AIX -D_ALL_SOURCE -qnoro -qmaxmem=3000 -bfl" $*
  710. Apparently some (but not all) releases of the C library declare the hypot
  711. function: if the declaration in math_.h produces an error message, try
  712. removing it.  Also, the IBM X11R3 server is known to be buggy: use the MIT
  713. X server if possible.
  714.     The xlc 1.3.0.x compiler provided in AIX 3.2.5+ definitely will not
  715. compile Ghostscript correctly if -O is used on all files.  A user has
  716. reported that compiling just the z*.c files without -O is sufficient to
  717. produce a working executable.
  718.  
  719. SCO Unix/Xenix:
  720.     The SCO Unix C compiler apparently can't handle the Pn macros
  721. in std.h.  If you get strange compilation errors on SCO Unix, see if
  722. you can get a compiler fix from SCO.  Meanwhile, to use gcc with SCO
  723. ODT, see gcc-head.mak for the appropriate switch settings.  See also
  724. under "386 Unix" above.
  725.     gcc 2.3.3 produces code that causes a core dump on machines
  726. that don't have hardware floating point, because of a bug in SCO's
  727. floating point emulator.  Use a different compiler on these machines.
  728.     If you aren't using the X11 driver, you need to add -lsocket
  729. to the linker command (near the end of the unix-*.mak file) in order
  730. to get the date/time functions linked in.
  731.     If you want to use direct frame buffer addressing instead of X
  732. Windows, include the relevant frame buffer device(s) (ega.dev, vga.dev,
  733. etc.) and change gdevevga.c to gdevsco.c as indicated in devs.mak.  Note:
  734. this does not work with SuperVGA displays, except for 800x600x16 mode.
  735. Note also: If the display looks "smeared", try recompiling gdevpcfb.c with
  736. -O0.  Note also: if Ghostscript crashes, use the -q switch and/or redirect
  737. console output to a file.
  738.     If your compiler accepts the -Xt and -Xa switches, use -Xt.
  739. Even though this causes the compiler to use incorrect rules for
  740. computing the result types of << and >>, -Xa enables "optimizations"
  741. that produce incorrect code.
  742.     For SCO ODT 2.0, in addition to -D__SVR3 and -DSYSV, you need to
  743. specify -Dsco, -DUSG, and -DMALLOC_0_RETURNS_NULL.  For SCO ODT, you need
  744. EXTRALIBS=-lX11 -lsocket -lmalloc, or maybe only -lsocket (depending on
  745. the version), and for SCO ODT 2.0, you also need to specify -lc_s.  For
  746. SCO Xenix, you need EXTRALIBS=-lmalloc.
  747.     For all SCO systems, set XINCLUDE= and XLIBDIRS=.
  748.     Please also read the section on "System V Unix platforms" below.
  749.  
  750. SGI:
  751.     The SGI C compiler shipped with Irix 5.2 requires compiler
  752. options -cckr.
  753.  
  754. Sun:
  755.     The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript
  756. properly if the -fast option is selected: Ghostscript core-dumps in
  757. build_gs_font.  Use -g, or use gcc.
  758.     The Sun version of dbx often gives up with an error message when
  759. trying to load Ghostscript.  If this happens, use gdb instead.  (gdb is
  760. more reliable than dbx in other ways as well.)
  761.     SunOS
  762.     -----
  763.         In SunOS 4.1.[23], you may get these undefined symbols when linking:
  764.                 _get_wmShellWidgetClass
  765.                 _get_applicationShellWidgetClass
  766. Compiling "-Bstatic -lXmu -Bdynamic" appears to work for SC1.0.  For gcc,
  767. try adding "-static" to CFLAGS.  To solve the problem if you are using
  768. OpenWindows 3.0 (X11R4-based Xt), please contact your local Sun office and
  769. request the following patches:
  770.     Patch i.d.      Description
  771.     100512-02       4.1.x OpenWindows 3.0 libXt Jumbo patch
  772.     100573-03       4.1.x OpenWindows 3.0 undefined symbols when using
  773.                 shared libXmu
  774.     Solaris
  775.     -------
  776.     Solaris 2.2 may require setting EXTRALIBS=-lsocket.
  777.     Solaris 2.3 and 2.4 seem to require EXTRALIBS=-lnsl -lsocket.
  778.     Solaris 2.n uses /usr/openwin/share/include for the X11 libraries
  779. rather than /usr/local/X/include.
  780.     Solaris 2.n typically makes Type 1 fonts available in
  781. /usr/openwin/lib/X11/fonts/Type1/outline.
  782.     For Solaris 2.n, you will need to change the definition of INSTALL in
  783. the makefile from install -c to installbsd -c, since the Solaris version of
  784. 'install' requires
  785.         install -c <directory> [-m <mode>] <file>
  786. rather than
  787.         install [-c] [-m <mode>] <file> <directory>
  788.  
  789. SVR4 Unix platforms:
  790.     You may need to set EXTRALIBS=-lnsl.
  791.     Do *not* change PLATFORM=unix_ to PLATFORM=sysv_.
  792.     On SVR4 platforms that use dynamic library loading, you may need to
  793. add the following two lines to the makefile just before the final linking
  794. step (the line that says "$(SH) <ldt.tr"):
  795.         LD_RUN_PATH=$(XLIBDIR); \
  796.         export LD_RUN_PATH; \
  797.  
  798. System V Unix platforms:
  799.     If you are using a stock System V platform that lacks rename
  800. and gettimeofday, change PLATFORM=unix_ in the makefile to
  801. PLATFORM=sysv_.
  802.     You will probably need to change the definition of INSTALL (near
  803. the beginning of the makefile) from install to /usr/ucb/install.
  804.  
  805. VAX with [Open]VMS:
  806.     DEC C V4.0 or later is required.  Previous versions of the DEC C
  807. run-time library have bugs that prevent Ghostscript from working.
  808.  
  809. VAX with Ultrix:
  810.     The above information about DECStations with Ultrix may be
  811. applicable.
  812.  
  813. ********
  814. ******** How to build Ghostscript from source (VMS aka OpenVMS version) ****
  815. ********
  816.  
  817. The files VMS-CC.MAK, VMS-GCC.MAK, and VMS-DECC.MAK are OpenVMS DCL command
  818. files which build Ghostscript from scratch using, respectively, the VAX C
  819. compiler, CC, the Free Software Foundation's GNU C compiler, GCC, or the
  820. DEC C compiler, CC.  Accordingly, you must have one of these compilers
  821. installed in order to build Ghostscript.  (Other C compilers may work: CC
  822. and GCC are the only two compilers tested to date.)  These command files
  823. build and store the Ghostscript library in the object library GS.OLB.  If
  824. you have DECwindows (X11) installed on your system, the executable image
  825. GS.EXE will also be built.
  826.  
  827. Some environments use the DWTLIBSHR library for providing the X
  828. Windows intrinsics, and some use the XTSHR library.  XTSHR is newer,
  829. and is part of the DECwindows/Motif product.  However, DEC is still
  830. distributing versions of VMS with DWTLIBSHR.  If your environment
  831. uses XTSHR, replace DWTLIBSHR in the list of link libraries with
  832. XTSHR.
  833.  
  834. Many versions of DEC's X server have bugs that produce broad bands of color
  835. where dither patterns should appear, or characters displayed white on top
  836. of black rectangles or not displayed at all.  If this happens, please
  837. consult the X Windows section of the use.doc file to find out how to work
  838. around these bugs using X resources; also report the problem to DEC, or
  839. whoever supplied your X server.
  840.  
  841. You may also wish to turn off the use of a backing pixmap with Ghostscript,
  842. either to work around X server memory limitations or bugs, or to obtain
  843. faster displaying at the expense of no redrawing when a Ghostscript window
  844. is restored from an icon or exposed after being occluded by another window.
  845. Again, use.doc contains information on how to do this.
  846.  
  847. For OpenVMS VAX platforms with VAX C, issue the DCL command
  848.     $ @VMS-CC.MAK
  849. to build Ghostscript.  For OpenVMS platforms with GNU C (either AXP or
  850. VAX), issue the DCL command
  851.     $ @VMS-GCC.MAK
  852. to build Ghostscript.  For OpenVMS platforms with DEC C (either AXP or
  853. VAX), issue the DCL command
  854.     $ @VMS-DECC.MAK
  855. to build Ghostscript.
  856.  
  857. The option "DEBUG" may be specified with either command file in order to
  858. build a debuggable Ghostscript configuration; e.g.,
  859.     $ @VMS-CC.MAK DEBUG
  860.  
  861. In order to specify switches and file names when invoking the interpreter,
  862. define GS as a foreign command:
  863.     $ GS == "$disk:[directory]GS.EXE"
  864. where "disk" and "directory" specify the disk and directory where Ghostscript
  865. is located.  For instance,
  866.     $ GS == "$DUA1:[GHOSTSCRIPT]GS.EXE"
  867. To allow the interpreter to be run from any directory, define the logical
  868. GS_LIB which points to the Ghostscript directory
  869.     $ DEFINE GS_LIB disk:[directory]
  870. This allows Ghostscript to locate its initialization files stored in the
  871. Ghostscript directory -- see use.doc for further details.  Finally, to
  872. invoke the interpreter, merely type GS.  Although DCL normally converts
  873. unquoted parameters to upper case, C programs receive their parameters in
  874. lower case.  That is, the command
  875.     $ GS -Isys$login:
  876. passes the switch "-isys$login" to the interpreter.  To preserve the
  877. case of switches, enclose them in double quotes; e.g.,
  878.     $ GS "-Isys$login:"
  879.  
  880. If you add compiled fonts to your system as described in the fonts.doc file,
  881. then add the font source file names to MODULES.LIS, add "ccfonts.dev" to the
  882. FEATURE_DEVS symbol in VMS-CC.MAK, VMS-GCC.MAK, or VMS-DECC.MAK,
  883.     $ FEATURE_DEVS = "level2.dev ccfonts.dev"
  884. and then specify the font names with the ccfonts1 symbol
  885.     $ ccfonts1 = "Courier Courier_Oblique Courier_Bold Courier_BoldOblique"
  886. If the line gets too long, add another line of the same form, e.g.,
  887.     $ ccfonts1 = "Courier Courier_Oblique Courier_Bold Courier_BoldOblique"
  888.     $ ccfonts2 = "Times_Roman Times_Italic Times_Bold Times_BoldItalic"
  889.  
  890. ********
  891. ******** A guide to the files ********
  892. ********
  893.  
  894. General
  895. -------
  896.  
  897. There are very few machine dependencies in Ghostscript.  A few of the .c
  898. files are machine-specific.  These have names of the form
  899.     gp_<platform>.c
  900. specifically
  901.     gp_dosfb.c (MS-DOS)
  902.     gp_dosfs.c (MS-DOS and MS Windows)
  903.     gp_itbc.c (MS-DOS, Borland compilers)
  904.     gp_iwatc.c (MS-DOS, Watcom or Microsoft compiler)
  905.     gp_msdos.c (MS-DOS and MS Windows)
  906.     gp_ntfs.c (MS-Windows Win32s and Windows NT)
  907.     gp_os2.c (OS/2)
  908.     gp_os9.c (OS-9)
  909.     gp_unifs.c (Unix or OS-9)
  910.     gp_unix.c (Unix)
  911.     gp_sysv.c (System V Unix)
  912.     gp_vms.c (VMS)
  913.     gp_win32.c (MS-Windows Win32s and Windows NT)
  914. There are also some machine-specific conditionals in files with names
  915. <something>_.h.  If you are going to extend Ghostscript to new
  916. machines or operating systems, you should check the *_.h files for
  917. ifdef's on things other than DEBUG, and you should probably count on
  918. making a new makefile and a new gp_ file.
  919.  
  920. Library
  921. -------
  922.  
  923. Files beginning with gs, gx, or gz (both .c and .h), other than gs.c
  924. and gsmain.c, are the Ghostscript library.  Files beginning with gdev
  925. are device drivers or related code, also part of the library.  Other
  926. files beginning with g are library files that don't fall neatly into
  927. either the kernel or the driver category.
  928.  
  929. Interpreter
  930. -----------
  931.  
  932. gs.c is the main program for the interactive language interpreter;
  933. gsmain.c is the top level of initialization code.  If you configure
  934. Ghostscript as a server rather than an interactive program, you will use
  935. gsmain.c but not gs.c.
  936.  
  937. Files named z*.c are Ghostscript operator files.  The names of the files
  938. generally follow the section headings of the operator summary in section
  939. 6.2 of the PostScript manual.
  940.  
  941. Files named i*.c, and *.h other than g*.h, are the rest of the
  942. interpreter.  See the makefile for a little more information on how the
  943. files are divided functionally.
  944.  
  945. Files named s*.c are a flexible stream package, including the Level 2
  946. PostScript 'filters' supported by Ghostscript.
  947.